<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增渠道配置')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-channelswitch-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">应用：</label>
                <div class="col-sm-8">
                    <select name="appId" class="form-control m-b" th:with="type=${@dict.getType('kkad_app_id')}" style="pointer-events: none;">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:selected="*{appId} == ${dict.dictValue}" ></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">渠道ID：</label>
                <div class="col-sm-8">
                    <input name="channel" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">渠道名称：</label>
                <div class="col-sm-8">
                    <input name="name" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">截止日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="endTime" class="form-control" placeholder="yyyy-MM-dd HH:mm:ss" type="text" required>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">指定版本：</label>
                <div class="col-sm-8">
                    <input name="version" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "kkad/channelswitch"
        $("#form-channelswitch-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-channelswitch-add').serialize());
            }
        }

        $("input[name='endTime']").datetimepicker({
            format: "yyyy-mm-dd hh:ii:00",
            autoclose: true
        });

    </script>
</body>
</html>